package oop.ex2.tokenizer;

/**
 * This is the base class for all analyzers that recognize a binary operator.
 * It enforces the rule that an binary operator must be surrounded by whitespace.
 * @author daniel_i_l
 *
 */
public abstract class BinaryOpAnalyzer extends TokenAnalyzer {
	private static final String MANDATORY_WHITESPACE = "\\s";
	
	/**
	 * Construct a binary analyzer that searches for a specific operator.
	 * @param tokenPattern The operator pattern to search for.
	 */
	public BinaryOpAnalyzer(String tokenPattern) {
		super(WHITESPACE + MANDATORY_WHITESPACE + tokenPattern + MANDATORY_WHITESPACE + WHITESPACE);
	}
}
